package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderZkController {

    /*public static final String INVOKE_URL = "http://cloudprovider-payment";*/


    /**
     * 通过springDI注入完成配置文件的服务名称的动态编写功能
     */
    @Value("${service-url.nacos-user-service}")
    private String t;
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/payment/zk")
    public String paymentInfo(){

        String result = restTemplate.getForObject(t+"/payment/zk",String.class);
        System.out.println(t+"        xxx");
        return result;
    }

}
